/*
httprouter

http://127.0.0.1:8080
http://127.0.0.1:8080/hello/zxy

*/
package main

import (
	"fmt"
	"net/http"

	"github.com/julienschmidt/httprouter"
)

func index(w http.ResponseWriter, r *http.Request, param httprouter.Params) {
	fmt.Fprint(w, "Hello!")
}

func hello(w http.ResponseWriter, r *http.Request, param httprouter.Params) {
	fmt.Fprintf(w, "Hello, %s", param.ByName("name"))
}

func main() {
	router := httprouter.New()
	router.GET("/", index)
	router.GET("/hello/:name", hello)

	http.ListenAndServe(":8080", router)
}
